package cn.idongjia.logloader.mongo;
import java.io.Serializable;

/**
 * 日志信息
 * Created by wangdawei on 15/11/30.
 */
public class LogInfo implements Serializable {
    private String _id;

    private String time;

    private String logLevel;

    private String moduleId;
    private String serverId;


    private String logName;

    private String visitId;

    private String msg;
    /**
     * 时间的整型格式，用于排序查询
     */
    private long ltime;

    public LogInfo() {

    }

    public LogInfo(LogLevel logLevel, String moduleId, String visitId, String msg) {
        this.logLevel = logLevel.getLevel();
        this.moduleId = moduleId;
        this.visitId = visitId;
        this.msg = msg;
    }



    public String getLogLevel() {
        return logLevel;
    }

    public void setLogLevel(LogLevel logLevel) {
        this.logLevel = logLevel.getLevel();
    }

    public String getModuleId() {
        return moduleId;
    }

    public void setModuleId(String moduleId) {
        this.moduleId = moduleId;
    }

    public String getVisitId() {
        return visitId;
    }

    public void setVisitId(String visitId) {
        this.visitId = visitId;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public long getLtime() {
        return ltime;
    }

    public void setLtime(long ltime) {
        this.ltime = ltime;
    }

    public String getTime() {
        return time;
    }

    public void setTime(String time) {
        this.time = time;
    }

    public String getLogName() {
        return logName;
    }

    public void setLogName(String logName) {
        this.logName = logName;
    }

    public String getServerId() {
        return serverId;
    }

    public void setServerId(String serverId)
    {
        this.serverId = serverId;
    }

    public String get_id() {
        return _id;
    }

    public void set_id(String _id) {
        this._id = _id;
    }

//        @Override
//    public String toString() {
//        return "LogInfo{" +
//                "id='" + _id + '\'' +
//                ", time='" + time + '\'' +
//                ", logLevel='" + logLevel + '\'' +
//                ", moduleId='" + moduleId + '\'' +
//                ", serverId='" + serverId + '\'' +
//                ", logName='" + logName + '\'' +
//                ", visitId='" + visitId + '\'' +
//                ", msg='" + msg + '\'' +
//                ", ltime=" + ltime +
//                '}';
//    }

    public String toString() {
        return "[" + time + "] " +logLevel + " " + logName + ": " + msg;
    }
}


